﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace Movie.DAL
{
   public  class CinemaDAL
    {
       public static List<Modal.Cinema> GetCinema(string id, DateTime time) 
       {
           string sql = string.Format("select * from Cinema where CinemaID in(select CinemaID from Room where RoomId in(select RoomId from Schedule where MovieId='{0}' and ScheduleDate>='{1}'))",id,time);
           SqlDataReader reder = sqlHelper2.ExcuteReader(sql);
           List<Modal.Cinema> list = new List<Modal.Cinema>();          
           while (reder.Read())
           {
               Modal.Cinema cinema = new Modal.Cinema();
               cinema.CinemaID=Convert.ToInt32 (reder["CinemaID"]);
               cinema.Name = reder["Name"].ToString();
               cinema.Address = reder["Address"].ToString();
               cinema.PostalCode = reder["PostalCode"].ToString();
               cinema.WebSite = reder["WebSite"].ToString();
               cinema.Phone = reder["Phone"].ToString();
               list.Add(cinema);
           }
           reder.Close();
           return list;

       }

    }
}
